// pages/conversation/components/message.js
Component({
  options: {
    multipleSlots: true
  },
  /**
   * 组件的属性列表
   */
  properties: {
    message: Object
  },
  relations: {
    './message/image': {
      type: 'child'
    },
    './message/text': {
      type: 'child'
    },
    './message/voice': {
      type: 'child'
    }
  },
  /**
   * 组件的初始数据
   */
  data: {
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onPlayVoice: function (event) {
      this.triggerEvent('onplay', event.detail)
    },
    onPlayMusic: function(event){
      this.triggerEvent('onplaymusic', event.detail)
    },
    onMusicStop: function (event){
      this.triggerEvent('onmusicstop', event.detail)
    },
    onPreviewImage: function(event){
      let {detail} = event;
      this.triggerEvent('onpreviewimage', detail);
    },
    onLookQuestion: function (event) {
      let index = event.currentTarget.dataset.index;
      this.triggerEvent('lookquestion', index);
    },
    gotoResolve: function(e) {
      var url = e.currentTarget.dataset.link;
      if (url.indexOf('h5web/pages/obuBluetooth/obuList.html') != -1) {
        url = "https://wx.my56app.com/baseWeb/h5web/pages/obuBluetooth/obuList.html";
      }
      wx.navigateTo({
        url: '../../../../index/webView?url='+url,
      })
    }
  }
})
